<?php
class User_Model_ShippingMethod extends Zend_Db_Table{
	protected $_name = 'shipping_method';
	protected $_primary = 'shipping_id';
	/* Link tham khao : http://framework.zend.com/manual/en/zend.db.table.html */
	/* select demo */
	
	// ham lay thong tin Shipping len
	public function getAllShipping()
	{// co dung
		
		$client = new Zend_Rest_Client(HTTP_SERVICE);
		$return = $client->restGet("/shippingmethod/route/getAllShipping");
		$return = json_decode(json_encode((array) simplexml_load_string($return->getBody())),1);
		
		for ($i=0;$i <count($return);$i++)
				$data[$i] = $return['row_'.$i];
			
		return $data;
	}
	
	//lay shipping method theo id
	public function getShippingMethodById($id)
	{// co dung
		$client = new Zend_Rest_Client(HTTP_SERVICE);
		$return = $client->restGet("/shippingmethod/route/getShippingMethodById/id/".$id);
		$return = json_decode(json_encode((array) simplexml_load_string($return->getBody())),1);
		
		for ($i=0;$i <count($return);$i++)
				$data[$i] = $return['row_'.$i];
				
		return $data;
		
	}
}